package com.pylc.model.entity;

import com.pylc.model.constant.StoreState;
import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;

import javax.persistence.*;
import java.util.Date;
import java.util.List;

/**
 * @author Lindsey
 */
@Entity
@Table
public class Store extends BaseEntity {
    private String name;
    private String ownerRealName;
    private Boolean isAuthenticated;
    private Boolean isOwnerAuthenticated;
    private String ownerIdCard;
    private String address;
    private String zip;
    private String telephone;
    private String idCardImage;
    private String licenseImage;
    private StoreState state;
    private Date closedDate;
    private String closedReason;
    private Integer sortOrder;
    private String banner;
    private String logo;
    private String seoKeywords;
    private String seoDescription;
    private String description;
    private Boolean isRecommended;
    private Boolean isAudited;
    private String photo;

    private StoreCategory category;
    private StoreGrade grade;
    private Member member;
    private Mall mall;
    private Brand brand;

    private List<StorePartner> partners;
    private List<StoreActivity> activities;

    @Column
    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    @Column
    public Boolean getAudited() {
        return isAudited;
    }

    public void setAudited(Boolean audited) {
        isAudited = audited;
    }

    @Column
    public String getBanner() {
        return banner;
    }

    public void setBanner(String banner) {
        this.banner = banner;
    }

    @ManyToOne
    @JoinColumn(name="category_id")
    public StoreCategory getCategory() {
        return category;
    }

    public void setCategory(StoreCategory category) {
        this.category = category;
    }

    @Column
    public Date getClosedDate() {
        return closedDate;
    }

    public void setClosedDate(Date closedDate) {
        this.closedDate = closedDate;
    }

    @Column
    public String getClosedReason() {
        return closedReason;
    }

    public void setClosedReason(String closedReason) {
        this.closedReason = closedReason;
    }

    @Column
    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    @ManyToOne
    @JoinColumn(name="grade_id")
    public StoreGrade getGrade() {
        return grade;
    }

    public void setGrade(StoreGrade grade) {
        this.grade = grade;
    }

    @Column
    public String getIdCardImage() {
        return idCardImage;
    }

    public void setIdCardImage(String idCardImage) {
        this.idCardImage = idCardImage;
    }

    @Column
    public Boolean getRecommended() {
        return isRecommended;
    }

    public void setRecommended(Boolean recommended) {
        isRecommended = recommended;
    }

    @Column
    public String getLicenseImage() {
        return licenseImage;
    }

    public void setLicenseImage(String licenseImage) {
        this.licenseImage = licenseImage;
    }

    @Column
    public String getLogo() {
        return logo;
    }

    public void setLogo(String logo) {
        this.logo = logo;
    }

    @ManyToOne
    @JoinColumn(name="mall_id")
    public Mall getMall() {
        return mall;
    }

    public void setMall(Mall mall) {
        this.mall = mall;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name="member_id")
    public Member getMember() {
        return member;
    }

    public void setMember(Member member) {
        this.member = member;
    }

    @Column
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Column
    public String getOwnerIdCard() {
        return ownerIdCard;
    }

    public void setOwnerIdCard(String ownerIdCard) {
        this.ownerIdCard = ownerIdCard;
    }

    @Column
    public String getOwnerRealName() {
        return ownerRealName;
    }

    public void setOwnerRealName(String ownerRealName) {
        this.ownerRealName = ownerRealName;
    }

    @Column
    public String getPhoto() {
        return photo;
    }

    public void setPhoto(String photo) {
        this.photo = photo;
    }

    @Column
    public String getSeoDescription() {
        return seoDescription;
    }

    public void setSeoDescription(String seoDescription) {
        this.seoDescription = seoDescription;
    }

    @Column
    public String getSeoKeywords() {
        return seoKeywords;
    }

    public void setSeoKeywords(String seoKeywords) {
        this.seoKeywords = seoKeywords;
    }

    @Column
    public Integer getSortOrder() {
        return sortOrder;
    }

    public void setSortOrder(Integer sortOrder) {
        this.sortOrder = sortOrder;
    }

    @Column
    public StoreState getState() {
        return state;
    }

    public void setState(StoreState state) {
        this.state = state;
    }

    @Column
    public String getTelephone() {
        return telephone;
    }

    public void setTelephone(String telephone) {
        this.telephone = telephone;
    }

    @Column
    public String getZip() {
        return zip;
    }

    public void setZip(String zip) {
        this.zip = zip;
    }

    @OneToMany(fetch = FetchType.LAZY)
    @JoinColumn(name="store_id")
    @Cascade(value = { CascadeType.DELETE })
    @OrderBy("sortOrder asc")
    public List<StoreActivity> getActivities() {
        return activities;
    }

    public void setActivities(List<StoreActivity> activities) {
        this.activities = activities;
    }

    @OneToMany(fetch = FetchType.LAZY)
    @JoinColumn(name="store_id")
    @Cascade(value = { CascadeType.DELETE })
    @OrderBy("sortOrder asc")
    public List<StorePartner> getPartners() {
        return partners;
    }

    public void setPartners(List<StorePartner> partners) {
        this.partners = partners;
    }

    @ManyToOne
    @JoinColumn(name="brand_id")
    public Brand getBrand() {
        return brand;
    }

    public void setBrand(Brand brand) {
        this.brand = brand;
    }

    @Column
    public Boolean getAuthenticated() {
        return isAuthenticated;
    }

    public void setAuthenticated(Boolean authenticated) {
        isAuthenticated = authenticated;
    }

    @Column
    public Boolean getOwnerAuthenticated() {
        return isOwnerAuthenticated;
    }

    public void setOwnerAuthenticated(Boolean ownerAuthenticated) {
        isOwnerAuthenticated = ownerAuthenticated;
    }
}
